<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <title>动弹</title>
    <link rel="stylesheet" type="text/css" href="../css/amazeui.min.css" />
    <link rel="stylesheet" type="text/css" href="../css/api.css" />
     <link rel="stylesheet" type="text/css" href="../css/tngou.css" />
  
</head>
<body>
	 <!-- 头部 -->	
<header data-am-widget="header" id="header"
          class="am-header am-header-default am-header-fixed"  >
          
      <div class="am-header-left am-header-nav">
          <a href="#" class="" id="back">
                <i class="am-header-icon am-icon-chevron-left"></i>
          </a>
      </div>
      <h1 class="am-header-title">发布动弹</h1>  
      
</header>


 <div class="am-g">

<div id="send-memo"  class="am-form am-margin" >
  <fieldset>
  
  
  
	 <div class="am-form-group am-form-warning">
	 <span class="am-text-xs  am-text-warning">今天你动弹了吗？发布今日动弹</span> 
      <textarea class="" rows="5" id="memo" name="memo"  placeholder="发布今日心情动弹"></textarea>    
    </div>	 
    <div class="am-form-group">
    <button class="am-btn am-btn-warning am-radius am-btn-block" type="button" onclick="sendMemo();" id="work-update-sub">发布动弹</button>   
    </div>
 
 
</div>
</div>


        
</body>
<script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript" src="../script/jquery.min.js"></script>
<script type="text/javascript" src="../script/amazeui.min.js"></script>
<script type="text/javascript" src="../script/config.js"></script>
<script type="text/javascript">
  
	apiready = function(){


	 $api.addEvt($api.byId('back'), 'click', function(){
            api.closeWin();
        });	
	};
	

  function sendMemo()
	{
	  var url='./login.html';
	  var  name='login';
	   access_token=$api.getStorage('access_token');
       if(!access_token){
			     api.openWin({ //新的窗口
			        name:name,
				    url: url				    
				  });
		  return;		  
		}
		
		  var memo=  $("#memo").val();
		  if(!checkValue(memo,Match.empty))
		  {
			$("#memo").focus();
			api.toast({msg : '动弹的内容不能为空！'});
		    return;
		 }	
		
		 api.showProgress({
			    style: 'default',
			    animationType: 'fade',
			    title: '发布动弹中...',
			    text: '请稍候...',
			    modal: false
			});
		  api.ajax({
			    url: OpenAPI.memo_add,
			    method: 'post',
			    dataType: 'json',
			    returnAll:false,
			    data:{
			        values: {access_token:access_token,memo:memo}
			    }
			},function(ret,err){
			    
			    api.hideProgress();
			   // api.alert({msg: JSON.stringify(ret)});
			    if(ret.status)
			    {
			       api.toast({msg : '添加成功'});
			       api.closeWin();	   		
						
			    }else
			    {
			        
			        api.toast({msg : ret.msg});		    
			    }
			    
			});
	  
	}


</script>
</html>